import Vue from 'vue'
import Router from 'vue-router'
import index from '@/views/index'
import page1 from '@/views/vue/page1'
import page2 from '@/views/vue/page2'
import page3 from '@/views/vue/page3'
import goback from '@/views/vue/goback'
import scrollBar from '@/views/vue/scrollBar'
import tableBar from '@/views/vue/tableBar'
import template from '@/views/vue/template'
import menuTemplate from '@/views/vue/menuTemplate'
import markdown from '@/views/vue/markdown'
import tinymce from '@/views/vue/tinymce'
import echarts from '@/views/vue/echarts'
import downExcel from '@/views/vue/downExcel'
import fontStyle from '@/views/vue/fontStyle'
import markdownEditor from '@/views/markdownEditor'
import searchHeight from '@/views/searchHeight'
import wxgd from '@/views/vue/wxgd'
import wxgd2 from '@/views/vue/wxgd2'


Vue.use(Router)

export default new Router({
  routes: [{
      path: '/',
      name: 'index',
      component: index,
      meta: {
        keepAlive: true, //此组件需要被缓存
        isBack: false, //用于判断上一个页面是哪个
      }
    },
    {
      path: '/page1',
      name: 'page1',
      component: page1,
      meta: {
        keepAlive: true, //此组件需要被缓存
        isBack: false, //用于判断上一个页面是哪个
      }
    },
    {
      path: '/page2',
      name: 'page2',
      component: page2,
      meta: {
        keepAlive: true, // 此组件需要被缓存
        isBack: false, //用于判断上一个页面是哪个
      }
    },
    {
      path: '/page3',
      name: 'page3',
      component: page3,
      meta: {
        keepAlive: false, // 此组件不需要被缓存
      }
    },
    {
      path: '/goback',
      name: 'goback',
      component: goback,
      meta: {
        keepAlive: false, // 此组件不需要被缓存
      }
    },
    {
      path: '/scrollBar',
      name: 'scrollBar',
      component: scrollBar,
      meta: {
        keepAlive: false, // 此组件不需要被缓存
      }
    },
    {
      path: '/tableBar',
      name: 'tableBar',
      component: tableBar,
      meta: {
        keepAlive: false, // 此组件不需要被缓存
      }
    },
    {
      path: '/template',
      name: 'template',
      component: template,
      meta: {
        keepAlive: false, // 此组件不需要被缓存
      }
    },
    {
      path: '/menuTemplate',
      name: 'menuTemplate',
      component: menuTemplate,
      meta: {
        keepAlive: false, // 此组件不需要被缓存
      }
    },
    {
      path: '/markdown',
      name: 'markdown',
      component: markdown,
      meta: {
        keepAlive: false, // 此组件不需要被缓存
      }
    },
    {
      path: '/tinymce',
      name: 'tinymce',
      component: tinymce,
      meta: {
        keepAlive: false, // 此组件不需要被缓存
      }
    },
    {
      path: '/echarts',
      name: 'echarts',
      component: echarts,
      meta: {
        keepAlive: false, // 此组件不需要被缓存
      }
    },
    {
      path: '/downExcel',
      name: 'downExcel',
      component: downExcel,
      meta: {
        keepAlive: false, // 此组件不需要被缓存
      }
    },
    {
      path: '/markdownEditor',
      name: 'markdownEditor',
      component: markdownEditor,
      meta: {
        keepAlive: false, // 此组件不需要被缓存
      }
    },
    {
      path: '/searchHeight',
      name: 'searchHeight',
      component: searchHeight,
      meta: {
        keepAlive: false, // 此组件不需要被缓存
      }
    },
    {
      path: '/fontStyle',
      name: 'fontStyle',
      component: fontStyle,
      meta: {
        keepAlive: false, // 此组件不需要被缓存
      }
    },
    {
      path: '/wxgd',
      name: 'wxgd',
      component: wxgd,
      meta: {
        keepAlive: false, // 此组件不需要被缓存
      }
    },
    {
      path: '/wxgd2',
      name: 'wxgd2',
      component: wxgd2,
      meta: {
        keepAlive: false, // 此组件不需要被缓存
      }
    }
  ],
  // mode: 'history',
  scrollBehavior(to, from, savedPosition) {
    if (savedPosition) {
      return savedPosition
    } else {
      return {
        x: 0,
        y: 0
      }
    }
  }
})
